#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
    int number, count, i;
    double price;
    double sum=0;
    for (i = 0; i < 2; i++)
    {
        cin >> number >> count >> price;
        sum += price * count;
    }
    cout << "VALOR A PAGAR: R$ ";
    printf("%.2lf\n", sum);
    return 0;
}